/**  

* @Title: AdministratorDaoHibernate.java 

* @Package com.gxbadge.dao.impl 

* @Description: TODO(用一句话描述该文件做什么) 

* @author CST

* @version V1.0  

*/ 

package com.gxbadge.dao.impl;

import java.util.List;

import com.gxbadge.dao.NavigationDao;
import com.gxbadge.dao.base.BaseHibernateDaoSupport;
import com.gxbadge.model.Navigation;

public class NavigationDaoHibernate extends BaseHibernateDaoSupport implements NavigationDao {

	/* 
	 * {见接口方法说明}
	 */
	public void delete(Navigation nav) {
		
		this.getHibernateTemplate().delete(nav);
		
	}

	/* 
	 * {见接口方法说明}
	 */
	public List<Navigation> findNavAll() {
		
		List<Navigation> navList = this.getHibernateTemplate().find("from Navigation");
		if(navList!=null&&navList.size()>=1){
			return navList;
		}
		return null;
	}

	public List<Navigation> findNavListByNavPid(int navPid){
		
		List<Navigation> navList = this.getHibernateTemplate().find("from Navigation as n where n.navPid=?", navPid);
		if(navList!=null&&navList.size()>=1){
			
			return navList;
		}
		return null;

	}
	
	/* 
	 * {见接口方法说明}
	 */
	public Navigation findNavByNavId(Integer navId) {
		
		Navigation nav = this.getHibernateTemplate().get(Navigation.class, navId);
		if(nav!=null){
			return nav;
		}
		return null;
	}

	/* 
	 * {见接口方法说明}
	 */
	public void save(Navigation nav) {
		
		this.getHibernateTemplate().save(nav);
		
	}

	/* 
	 * {见接口方法说明}
	 */
	public void update(Navigation nav) {
		
		this.getHibernateTemplate().update(nav);
		
	}
	
	
	
	
	/*---------------前台--------------------- */
	public Navigation findNavByNote(String note){
		
		List<Navigation> navList = this.getHibernateTemplate().find("from Navigation as n where n.note=?", note);
		if(navList!=null&&navList.size()==1){
			
			return navList.get(0);
			
		}else{
			return null;
		}
	}

	
}
